package org.jtao.gbsubject.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import java.io.Serializable;
import java.util.Objects;

/**
 * 现状实体
 */
@ApiModel(description = "现状实体")
@Entity
@Table(name = "current_state")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CurrentState implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "jhi_value")
    private Float value;

    @Column(name = "reference_value")
    private Float referenceValue;

    @Column(name = "deviation")
    private Float deviation;

    @ManyToOne
    private Subject subject;

    @ManyToOne
    private Indicator indicator;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Float getValue() {
        return value;
    }

    public CurrentState value(Float value) {
        this.value = value;
        return this;
    }

    public void setValue(Float value) {
        this.value = value;
    }

    public Float getReferenceValue() {
        return referenceValue;
    }

    public CurrentState referenceValue(Float referenceValue) {
        this.referenceValue = referenceValue;
        return this;
    }

    public void setReferenceValue(Float referenceValue) {
        this.referenceValue = referenceValue;
    }

    public Float getDeviation() {
        return deviation;
    }

    public CurrentState deviation(Float deviation) {
        this.deviation = deviation;
        return this;
    }

    public void setDeviation(Float deviation) {
        this.deviation = deviation;
    }

    public Subject getSubject() {
        return subject;
    }

    public CurrentState subject(Subject subject) {
        this.subject = subject;
        return this;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    public Indicator getIndicator() {
        return indicator;
    }

    public CurrentState indicator(Indicator indicator) {
        this.indicator = indicator;
        return this;
    }

    public void setIndicator(Indicator indicator) {
        this.indicator = indicator;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CurrentState currentState = (CurrentState) o;
        if (currentState.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), currentState.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "CurrentState{" +
            "id=" + getId() +
            ", value=" + getValue() +
            ", referenceValue=" + getReferenceValue() +
            ", deviation=" + getDeviation() +
            "}";
    }
}
